<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ include file="base.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="imagetoolbar" content="no" />
		<title>首页</title>
		<script>
		!window.jQuery && document.write('<script src="script\/jquery.js"><\/script>');
		</script>
		<link rel="stylesheet" type="text/css"	href="styles/style.css" />
		<script type="text/javascript" src="script/jquery.js"></script>
		<script type="text/javascript" src="script/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
		<link rel="stylesheet" type="text/css" href="script/fancybox/jquery.fancybox-1.3.4.css" media="screen" /> 
		<link rel="stylesheet" href="styles/default.css" />
		<script type="text/javascript">
		$(document).ready(function(){
			$("#concern").click(function(){
				if($("#userId").value != ""){
					$.post("concern!execute",{"userId":"${sessionScope.user.id}","postId":"${post.id}"},function(data){
						if(data != "isExist"){
							$("#c").html("收藏成功");
						}else{
							$("#c").html("你已经收藏过这篇帖子，无需再收藏");
						}
					});
				}else{
				 	var mdiv = "你还没有登录，请<a href='index!=login'>登录</a>后收藏该贴";
					$("#c").html(mdiv);
					}
			});
			$("#concern").fancybox({
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});
		});
		</script>
	</head>

	<body>
		<div class="container">
			<!-- 导航开始 -->
			<div class="nav">
				<a href="index.jspx">首页</a>
				&gt;&gt;
				<em><a href="board?id=${post.board.id }">${post.board.name }</a></em>
			</div>
			<!-- 导航结束 -->
		<!-- 头部结束 -->
		<!--   中间开始 -->
		<div class="center">
			<%@ include file="template/msg.file" %>
			<c:if test="${not empty post}">
					<div class="area">
						<!--   左边开始    -->
						<div class="size1">
							<div class="title">
								<h2>
									<a href="post.jspx?id=${post.id }"  target="_blank">${post.title }</a>
									<span><a href="#c" id="concern">关注该贴</a></span>
								</h2>
								<div style="display:none;">
									<div id="c" style="width:400px;height:300px;overflow:hidden;">
										
									</div>
								</div>
							</div>
							<div class="content">
								${post.content }
								<div class="hotnew">
									${post.user.name }发表于${post.createTime }
								</div>
							</div>
							<c:forEach items="${post.repostlist }" var="repost">
							<hr />
								<div class="content">
								${repost.content }
								<div class="hotnew">
									${repost.user.name }发表于${repost.createTime }
								</div>
							</div>
							</c:forEach>
							<c:choose>
								<c:when test="${not empty sessionScope.user }">
									<div class="content">
							<form action="repost!execute.jspx" method="post">
								<div class="hotnew">
									发表回复：
								</div>
								<input  type="hidden" name="postid" value="${post.id }"/>
								<input type="hidden" name="userid" id="userId" value="${post.user.id }"/>
							<table style="border:1px solid #A3CB44;width:800px;margin:30 auto;text-align:center;">
										<tr>
											<td width="200px">用户名：</td>
											<td>${sessionScope.user.name }</td>									
										</tr>
										<tr>
											<td>内容：</td>
											<td>
												<textarea name="content" style="width:400px;height:300px;">
													
												</textarea>
											</td>
										</tr>
										<tr><td></td><td><input type="submit"  class="btnstyle" id="reply_btn" value="发表回复"/></td></tr>
									</table>
							</form>
							</div>
								</c:when>
								<c:otherwise>
									<div class="hotnew">
										你还没有登录，请<a href="index!login">登录</a>后发表评论
									</div>
								</c:otherwise>
							</c:choose>
						</div>
						<div class="size2">
						
						</div>
					</div>
				</c:if>
				</div>
					<!--     中间结束   -->
			
					<%@include file="template/footer.jsp"%>
		</div>
	</body>
</html>
